﻿<!DOCTYPE HTML>
<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String path = request.getContextPath(); %>
<script src="<%=path%>/static/web/js/allmobilize.min.js" charset="utf-8" id="allmobilize"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/static/web/css/style.css"/>
<script src="<%=path%>/static/web/js/jquery.1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=path%>/static/web/js/jquery.lib.min.js"></script>
<script src="<%=path%>/static/web/js/sub.min.js"></script>
<script type="text/javascript">
    //初始化
    $(function () {
        cityes();
        $("#province").change(provinces);
        $("#listCity").change(cityes);
        provinces();
        selectCycle();
        $("#subscribeForm").submit(checkChoose);
    });
    //城市
    function provinces() {
        var privonceId = $("#province").val();
        var options=$("#province option:selected");
        $.ajax({
            url:"/zhuang/city",
            async:false,
            data:{privonceId:privonceId},
            success:function (citys) {
                $("#listCity").html("");
                var city = citys.split(",");//分割
                //数据开头为空，所有i从1开始
                for(var i=1;i<city.length;i++){
                    var cities = city[i].split(":");
                    var option = $("<option></option>");//创建option对象
                    option.val(cities[0]);//id
                    option.html(cities[1]);//城市名称
                    if(i==1){
                        $("#select_city_hidden").val(cities[0]);
                    }
                    $("#listCity").append(option);//累加
                }
            }
        });
    }
    //选中周期
    function selectCycle(){
        $(".s_radio>li").each(function(){
            $(this).click(function(){
                var cycleId = $(this).val();
                $("#cycle").val(cycleId);
            });
        });
    }
    //选中城市
    function cityes(){
        var cityId = $("#listCity option:selected").val();
        $("#select_city_hidden").val(cityId);

    }
    //检查必选项
    function checkChoose(){
        var cycleId = $("#cycle").val();
        var jobId = $("#select_job_hidden").val();
        var flag = false;
        if(cycleId==""){
            $("#sendError").css("display","block");
            $("#backtop").click();
        }
        else{
            $("#sendError").css("display","none");
        }
        if(jobId==""){
            $("#positionError").css("display","block");
            $("#backtop").click();
        }
        else{
            $("#positionError").css("display","none");
        }
        if(cycleId!=""&&jobId!=""){
            flag = true;
        }
        return flag;
    }
</script>
<form  id="subscribeForm" action="/zhuang/user/subscribe" method="post">
    <input type="hidden" value="" name="id" id="orderId" />
    <div class="s_form">
        <p>筛选下面的职位订阅条件，实现精准匹配的个性化职位定制，我们帮你挑工作！</p>
        <dl>
            <dt>
                <h3>发送周期 <em></em><span>（必填）</span></h3>
            </dt>
            <dd>
                <input type="hidden" id="cycle" name="cycle.id" value=""/>
                <ul class="s_radio clearfix">
                    <c:forEach items="${cycles}" var="cycle">
                        <li title="${cycle.title}" value="${cycle.id}">${cycle.title}</li>
                    </c:forEach>
                </ul>
                <span id="sendError" class="error" style="display:none;">请选择发送周期</span>
            </dd>
        </dl>
        <dl>
            <dt>
                <h3>职位名称 <em></em><span>（必填）</span></h3>
            </dt>
            <dd>
                <input type="hidden" id="select_job_hidden" name="industryJob.id" value=""/>
                <input type="button" class="select" id="select_job" value="请选择职位名称"/>
                <span id="positionError" class="error" style="display:none;">请选择职位名称 </span>
                <div id="sub_box_job" class="dn">
                    <c:forEach items="${industrys}" var="industry">
                        <c:if test="${industry.parent.id eq null}">
                            <dl>
                                <dt>${industry.industryName}</dt>
                                <dd>
                                    <ul class="reset job_main">
                                        <c:forEach items="${industrys}" var="industryNext">
                                            <c:if test="${industryNext.parent.id eq industry.id}">
                                                <li>${industryNext.industryName}
                                                    <ul class="reset job_sub dn">
                                                        <c:forEach items="${industrys}" var="industryLast">
                                                            <c:if test="${industryLast.parent.id eq industryNext.id}">
                                                                <li value="${industryLast.id}">${industryLast.industryName}</li>
                                                            </c:if>
                                                        </c:forEach>
                                                    </ul>
                                                </li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                </dd>
                            </dl>
                        </c:if>
                    </c:forEach>
                </div>
            </dd>
        </dl>
        <dl>
            <dt>
                <h3>工作地点 <em></em><span>（必填）</span></h3>
            </dt>
            <dd>
                <input type="hidden" id="select_city_hidden" name="city.id" value=""/>
                <select id="province" name="province" style="width: 180px;border-left: 2px solid #019875;border: 2px solid #019875;margin-top: 20px;height: 38px;font-size: 20px;position:relative">
                    <c:forEach items="${requestScope.provinces}" var="province">
                        <option datas="${province.id}" name="${province.provinceName}"  value="${province.id}">${province.provinceName}</option>
                    </c:forEach>
                </select>
                <select id="listCity" name="listCity" style="width: 180px;border-left: 2px solid #019875;border: 2px solid #019875;margin-top: 20px;margin-left: 20px;height: 38px;font-size: 20px;position:relative">

                </select>
                <span id="cityError" class="error" style="display:none;">请选择工作地点 </span>
            </dd>
        </dl>
        <dl>
            <dt>
                <h3>行业领域 <em></em><span>（默认不限）</span></h3>
            </dt>
            <dd>
                <input type="hidden" id="select_industry_hidden" name="industry.id" value=""/>
                <input type="button" class="select" id="select_industry" value="请选择行业领域"/>
                <div id="box_industry" class="dn">
                    <ul class="reset">
                        <c:forEach items="${industrys}" var="industry">
                            <c:if test="${industry.parent.id eq null}">
                                <c:forEach items="${industrys}" var="industryNext">
                                <c:if test="${industryNext.parent.id eq industry.id}">
                                    <li value="${industryNext.id}">${industryNext.industryName}</li>
                                </c:if>
                                </c:forEach>
                            </c:if>
                        </c:forEach>
                    </ul>
                </div>
                <span id="fieldError" class="error" style="display:none;">请选择行业领域 </span>
            </dd>
        </dl>
        <dl>
            <dt>
                <h3>月薪范围 <em></em><span>（默认不限）</span></h3>
            </dt>
            <dd>
                <input type="hidden" id="select_salary_hidden" name="money.id" value=""/>
                <input type="button" class="select" id="select_salary" value="请选择月薪范围"/>
                <div id="box_salary" class="dn">
                    <ul class="reset">
                        <c:forEach items="${monies}" var="money">
                            <li value="${money.id}">${money.range}</li>
                        </c:forEach>
                    </ul>
                </div>
                <span id="salaryError" class="error" style="display:none;">请选择月薪范围 </span>
            </dd>
        </dl>
        <dl>
            <dt>
                <h3>公司发展阶段 <em></em><span>（默认不限）</span></h3>
            </dt>
            <dd>
                <input type="hidden" id="select_stage_hidden" name="stage.id" value=""/>
                <ul class="s_tips clearfix s_radio_sp">
                    <c:forEach items="${stages}" var="stage" varStatus="stat">
                        <c:if test="${!stat.first && !stat.last}">
                            <li title="${stage.stageName}" value="${stage.id}">${stage.stageName}</li>
                        </c:if>
                    </c:forEach>
                </ul>
                <span id="stageError" class="error" style="display:none;">请选择发展阶段 </span>
            </dd>
        </dl>
        <input type="submit" class="btn_big" id="submit" value="保 存"/>
        <a href="javascript:;" class="btn_cancel" id="cancel">取 消</a>
    </div>
</form>
